#include "StdAfx.h"
#include "MemLog.h"

const static int STR_BUFF_SIZE = 1000*1204;
static char g_PszBuffer[STR_BUFF_SIZE];
static int g_nIndex;

CMemLog::CMemLog(void)
{
	g_PszBuffer[0] = 0;
}


CMemLog::~CMemLog(void)
{
}

void CMemLog::Init()
{
	memset(g_PszBuffer, 0, sizeof(g_PszBuffer));
	g_nIndex = 0;
}

char* CMemLog::GetStrBuff()
{
	return g_PszBuffer;
}

void CMemLog::DumpToStrBuffer(LPSTR pszFormat, ...)
{
	va_list ptr;
	va_start(ptr, pszFormat);
#pragma warning (push)
#pragma warning(disable : 4995)
#pragma warning(disable : 4996)
	vsprintf( &g_PszBuffer[g_nIndex], pszFormat, ptr );
#pragma warning (pop)
	va_end(ptr);
	g_nIndex = strlen(g_PszBuffer);
	ASSERT(g_nIndex < STR_BUFF_SIZE);
}
